package com.kukudb.captcharepeater.controller;

import com.kukudb.captcharepeater.pojo.Promoters;
import com.kukudb.captcharepeater.pojo.ResponseMessage;
import com.kukudb.captcharepeater.serveice.AdminServericeImpl;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")    // localhost:81/api/user
@Slf4j
public class LoginControllerApi {

    @Autowired
    AdminServericeImpl adminServerice;

    @PostMapping("/login")
    public ResponseMessage<Promoters> login(@RequestBody Promoters promoters, HttpSession session) {
        log.info("login----------");
        Promoters login = adminServerice.login(promoters, session);
        return new ResponseMessage<>(200, "success", login);
    }
}
